//
//  Demo3App.swift
//  Demo3
//
//  Created by Bigboss on 2025/3/5.
//

import SwiftUI

@main
struct Demo3App: App {

    @State private var appModel = AppModel()

    var body: some Scene {
        WindowGroup {
             switch appModel.currentTestView {
             case .park:
                 ParkView()
                     .environmentObject(appModel)
             case .distributionRoom:
                 DistributionRoomView()
                     .environmentObject(appModel)
                     .transition(.opacity)
             }
         }
        .windowStyle(.plain) // 👈 禁用默认玻璃材质

        ImmersiveSpace(id: appModel.immersiveSpaceID) {
            ImmersiveView()
                .environment(appModel)
                .onAppear {
                    appModel.immersiveSpaceState = .open
                    appModel.isImmersiveActive = true
                }
                .onDisappear {
                    appModel.immersiveSpaceState = .closed
                    appModel.isImmersiveActive = false
                }
        }
        .immersionStyle(selection: .constant(.full), in: .full)
    }
}
